//
//  SLComposeButton.swift
//  Sina15
//
//  Created by 盼 on 16/4/20.
//  Copyright © 2016年 pan. All rights reserved.
//

import UIKit

let imageW: CGFloat = 80
let imageH: CGFloat = imageW

class SLComposeButton: UIButton {
    
    var composeItem: SLComposeItem? {
        didSet {
            setTitle(composeItem!.title, forState: .Normal)
            setImage(UIImage(named: composeItem!.icon ?? ""), forState: .Normal)
        }
    }

    override func imageRectForContentRect(contentRect: CGRect) -> CGRect {
        
        return CGRect(x: 0, y: 0, width: imageW, height: imageH)
    }
    
    override func titleRectForContentRect(contentRect: CGRect) -> CGRect {
        
        let titleH: CGFloat = contentRect.size.height - imageH
        
        return CGRect(x: 0, y: imageH, width: imageW, height: titleH)
    }

}
